{include file="layout/layout" /}
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>财务管理 - 提现申请</h3>
                <h5>网站系统财务管理提现申请</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="editForm" method="post">
        <input name="cu_id" value="{$res.cu_id}" type="hidden">
        <input name="user_id" value="{$res.id}" type="hidden">
        <input id="status" name="status" value="0" type="hidden">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>用户id</label>
                </dt>
                <dd class="opt">
                    <a class="open" href="{:url('User/detail',['id'=>$res.id])}" target="blank">
                    {$res.id}<i class="fa fa-external-link " title="新窗口打开"></i>
                    </a>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>用户名</label>
                </dt>
                <dd class="opt">{$res.nick_name}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>用户平台余额</label>
                </dt>
                <dd class="opt"><strong class="red">{$res.ua_account/100}</strong>元</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>申请提现金额</label>
                </dt>
                <dd class="opt"><strong class="red">{$res.cu_money/100}</strong>元</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>平台订单号</label>
                </dt>
                <dd class="opt">{$res.cu_order}</dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label>微信订单号</label>
                </dt>
                <dd class="opt">{$res.cu_wx_order}</dd>
            </dl>

           <!--  <dl class="row">
                <dt class="tit">
                    <label>银行账户名</label>
                </dt>
                <dd class="opt"></dd>
            </dl> -->

            <dl class="row">
                <dt class="tit">
                    <label>申请时间</label>
                </dt>
                <dd class="opt">{$res.cu_time|date='Y-m-d H:i:s'}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>状态</label>
                </dt>
                <dd class="opt">
                    {switch $res.cu_status}
                        {case -1}待审核{/case}
                        {case 1}审核通过{/case}
                        {case 2}审核失败{/case}
                    {/switch}
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">备注</dt>
                <dd class="opt">
                    <!--remark-->
                    <textarea class="input-txt" rows="4" cols="60" id="remark" name="remark"></textarea>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>提现流程</label>
                </dt>
                <dd class="opt">
                    1:用户前台申请提现<br>
                    2:管理员审核生成转账记录 ( 生成时并不会自动扣除平台费用,请按照汇款记录打款 ) <br>
                    3:财务转账给用户<br>
                    先转账后生成记录.<br>
                </dd>
            </dl>
            <div class="bot">
                {switch $res.cu_status}
                        {case -1}<a href="javascript:void(0);" onclick="confirm_withdrawals();" class="ncap-btn-big ncap-btn-green">去生成转账记录</a>
                        <a href="javascript:void(0);" onclick="cancel_withdrawals();" class="ncap-btn-big ncap-btn-green">拒绝提现</a> {/case}
                        {case 1}审核通过{/case}
                        {case 2}审核失败{/case}
                {/switch}
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    // 确定提现
    function confirm_withdrawals()
    {
        if ($.trim($('#remark').val()).length == 0) {
            layer.alert('请填写转账备注', {icon: 2});
            return false;
        }
        layer.confirm('将生成转账记录,确定吗?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    // 确定
                    $('#status').val('1');
                    $.ajax({
                        type : "POST",
                        url:"{:url('User/ajaxWith')}",
                        data : $('#editForm').serialize(),
                        dataType: "json",
                        success: function(data){
                            if(data.status == 1){
                                layer.alert(data.msg, {icon: 1});
                                location.reload();
                            }else{
                                layer.alert(data.msg, {icon: 2});
                            }
                        }
                    });
                }, function (index) {
                    layer.close(index);
                }
        );
    }
    // 拒绝提现
    function cancel_withdrawals() {
        if ($.trim($('#remark').val()).length == 0) {
            layer.alert('请填写拒绝备注', {icon: 2});
            return false;
        }
        layer.confirm('确定要拒绝用户提现吗?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    // 确定
                    $('#status').val('2');
                    $.ajax({
                        type : "POST",
                        url:"{:url('User/ajaxWith')}",
                        data : $('#editForm').serialize(),
                        dataType: "json",
                        success: function(data){
                            if(data.status == 1){
                                layer.alert(data.msg, {icon: 1});
                                location.reload();
                            }else{
                                layer.alert(data.msg, {icon: 2});
                            }
                        }
                    });
                }, function (index) {
                    layer.close(index);
                }
        );

    }
</script>
</body>
</html>